package cn.iocoder.yudao.module.bpm.dal.mysql.oaapply;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oaapply.OaApplyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.bpm.controller.admin.oaapply.vo.*;

/**
 * OA 请假申请 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface OaApplyMapper extends BaseMapperX<OaApplyDO> {

    default PageResult<OaApplyDO> selectPage(OaApplyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OaApplyDO>()
                .eqIfPresent(OaApplyDO::getUserId, reqVO.getUserId())
                .eqIfPresent(OaApplyDO::getReason, reqVO.getReason())
                .eqIfPresent(OaApplyDO::getProcessInstanceId, reqVO.getProcessInstanceId())
                .betweenIfPresent(OaApplyDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(OaApplyDO::getBm, reqVO.getBm())
                .eqIfPresent(OaApplyDO::getSqrq, reqVO.getSqrq())
                .eqIfPresent(OaApplyDO::getZsc, reqVO.getZsc())
                .eqIfPresent(OaApplyDO::getBpmDefKey, reqVO.getBpmDefKey())
                .orderByDesc(OaApplyDO::getId));
    }

}